package com.example.test.async.anotherWay;

import lombok.extern.slf4j.Slf4j;

import java.io.File;

@Slf4j
public class MyTask implements Runnable {
    private MyService myService;
    private File file;

    public MyTask(MyService myService, File file) {
        this.myService = myService;
        this.file = file;
    }

    @Override
    public void run() {
        long begin = System.currentTimeMillis();
        myService.recognize(file);
        long end = System.currentTimeMillis();
        log.info("单次识别耗时：{}", end - begin);
    }
}
